function Checkbox($state) {
	return {
		template: require('./checkbox.html'),
		less: require('./checkbox.less'),
		restrict: 'E',
		require: '^ngModel',
		transclude: true,
		scope: {
			model: '=ngModel',
			ngTrueValue: '=',
			ngFalseValue: '='
		},
		link: function(scope, elem, attrs, ctrl) {
			if (scope.model === scope.ngTrueValue) {
				scope.checkboxVal = true;
			} else if (scope.model === scope.ngFalseValue) {
				scope.checkboxVal = false;
			}
			$(elem).find('input').on('change', function(ev) {
				scope.checkboxVal = ev.currentTarget.checked;
				if (ev.currentTarget.checked === true) {
					ctrl.$setViewValue(scope.ngTrueValue);
				} else if (ev.currentTarget.checked === false) {
					ctrl.$setViewValue(scope.ngFalseValue); 
				}
			});
		}
	}
}

module.exports = Checkbox;